﻿jQuery(function ($) {
    CKEDITOR.replace('editor1');
});

function view() {
    cppei.install();

    var app = angular.module('viewApp', []);

    //  ng_cppei_config(app);

    app.controller("viewController", function ($scope, $http) {

        $scope.onSubmit = function (invalid) {
            if (!invalid) {
                var content = CKEDITOR.instances.editor1.getData();

                //alert(content);
                $http({
                    method: 'post',
                    url: cppei.api.getUrl('cms', 'article', 'create'),//'/WebApi?sys:sno=AppAuth&sys:act=Create',
                    data: { Title: $scope.title, content:content, tags:'新闻' }
                }).success(function (result, status) {
                    if (result.isSuccess) {
                        //.closeDialog(true, { value: 1 });
                    } else {
                        cppei.growlError(result.message);
                    }

                }).error(function (result, status) {

                    cppei.closeDialog(false, { value: 2 });

                });
            } else {
                cppei.growl('应用程序名称不能为空！');
            }

        }
    });
}